<template>
  <a-switch v-model="Archive" @change="submit" />
</template>
<script>
import { updateProjectById } from '@/api/common'
export default {
  name: 'switchContract',
  components: {},
  props: ['record'],
  data() {
    return {
      Archive: false
    }
  },
  computed: {},
  methods: {
    async getData() {
      this.Archive = this.record.Archive ? true : false
    },
    async submit() {
      const form = {
        Archive: this.Archive ? 1 : 0
      }
      await updateProjectById(this.record.id, form)
      this.$emit('update')
    }
  },
  mounted() {
    this.getData()
  }
}
</script>
<style lang="css" scoped></style>
